package com.dk.ssm.service.impl;

import com.dk.ssm.dao.EmpDao;
import com.dk.ssm.entity.Emp;
import com.dk.ssm.service.EmpService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmpServiceImpl implements EmpService {

    private final EmpDao empDao;

    public EmpServiceImpl(EmpDao empDao) {
        this.empDao = empDao;
    }

    @Override
    public List<Emp> getAllEmp() {
        return empDao.queryAll();
    }

    @Override
    public void addEmp(Emp emp) {
        empDao.insertEmp(emp);
    }

    @Override
    public Emp getEmpById(Integer id) {
        return empDao.queryEmpById(id);
    }

    @Override
    public void modifyEmp(Emp emp) {
        empDao.updateEmp(emp);
    }

    @Override
    public void remove(Integer id) {
        empDao.deleteEmp(id);
    }
}
